import React from 'react';
import { Route, Redirect, Switch } from 'react-router-dom';
import '../styles/home.css';
import CommonTop from '../components/CommonTop';
import CommonFooter from '../components/CommonFooter';
import Home from './home/Home';
import Flow from './flow/Flow';
import NewsList from './news/NewsList';
import NewsDetail from './news/NewsDetail';
import Problem from './problem/Problem';
import Contact from './contact/Contact';

const Index = ({ match }) => (
  <div>
    <CommonTop></CommonTop>
    <Switch>
      <Redirect exact path={match.url} to="/index/zhaoshang"/>
      <Route path={`${match.url}/zhaoshang`} component={Home}/>
      <Route path={`${match.url}/flow`} component={Flow}/>
      <Route path={`${match.url}/news/:id`} component={NewsDetail}/>
      <Route path={`${match.url}/news`} component={NewsList}/>
      <Route path={`${match.url}/problem`} component={Problem}/>
      <Route path={`${match.url}/contact`} component={Contact}/>
    </Switch>
    <CommonFooter></CommonFooter>
  </div>
)

export default Index